// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT

import { TabWidget, HorizontalBox, StyleMetrics, Palette } from "std-widgets.slint";
import { MailView } from "mail_view.slint";
import { HeaderView } from "header_view.slint";
import { DashboardView } from "dashboard_view.slint";
import { UsecasesPalette } from "../widgets.slint";

export global MainViewAdapter {
    callback select-language(index: int);
}

export component MainView {
    in property <bool> break-layout;

    forward-focus: focus-scope;
    focus-scope := FocusScope { }

    Rectangle {
        background: Palette.background;

        VerticalLayout {
            HeaderView {
                select-language(index) => {
                    MainViewAdapter.select-language(index)
                }
            }

            HorizontalLayout {
                TabWidget {
                    Tab {
                        title: @tr("Mail");

                        HorizontalBox {
                            MailView {
                                break-layout: root.break-layout;
                            }
                        }
                    }

                    Tab {
                        title: @tr("Dashboard");

                        HorizontalBox {
                            DashboardView { }
                        }
                    }
                }
            }
        }
    }
}
